<template>
  <el-container style="height:100%">
    <el-row class="padding_top_10" type="flex" align="middle">
      <el-form :model="txtsearch" class="searchform" :inline="true">
        <el-form-item label="资产数据字段">
          <el-input
            v-model="txtsearch.SYS_ASSET_A1_160"
            v-nulltext
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="中文名称">
          <el-input
            v-model="txtsearch.SYS_ASSET_A1_50"
            v-nulltext
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="关联表名">
          <el-input
            v-model="txtsearch.SYS_ASSET_A1_60"
            v-nulltext
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="字段分组名称">
          <el-input
            v-model="txtsearch.SYS_ASSET_A1_140"
            v-nulltext
            clearable
          ></el-input>
        </el-form-item>
        <!-- <el-button icon="el-icon-plus">新增</el-button> -->
      </el-form>
    </el-row>
    <el-main class="el-main_padding1">
      <el-table
        ref="table"
        v-loading="loading"
        border
        :data="tableData"
        stripe
        row-key="AUTOID"
        height="100%"
      >
        <el-table-column type="selection" width="40"> </el-table-column>
        <el-table-column type="index" width="40"> </el-table-column>
        <el-table-column v-if="false" prop="SYS_ASSET_A1_10" label="资产分类ID">
        </el-table-column>
        <el-table-column
          prop="SYS_ASSET_A1_160"
          width="150px"
          label="资产数据字段"
        >
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_50" width="130px" label="中文名称">
        </el-table-column>
        <el-table-column
          prop="SYS_ASSET_A1_20"
          width="90px"
          label="列表显示长度"
        >
        </el-table-column>
        <el-table-column
          prop="SYS_ASSET_A1_30"
          width="90px"
          label="列表字段排序"
        >
        </el-table-column>
        <el-table-column label="是否有效">
          <template slot-scope="scope">
            {{ scope.row.SYS_ASSET_A1_40 == 1 ? "是" : "否" }}
          </template>
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_60" label="关联表名">
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_70" label="关联字段名">
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_80" label="关联表显示名">
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_90" label="关联表查询条件">
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_100" label="关联表扩展显示字段">
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_110" label="关联表扩展显示中文">
        </el-table-column>
        <el-table-column label="是否列表显示">
          <template slot-scope="scope">
            {{ scope.row.SYS_ASSET_A1_120 == 1 ? "是" : "否" }}
          </template>
        </el-table-column>
        <el-table-column label="是否编辑页面显示">
          <template slot-scope="scope">
            {{ scope.row.SYS_ASSET_A1_130 == 1 ? "是" : "否" }}
          </template>
        </el-table-column>
        <el-table-column prop="SYS_ASSET_A1_140" label="字段分组名称">
        </el-table-column>
        <el-table-column
          v-if="false"
          prop="SYS_ASSET_A1_150"
          label="编辑页面字段排序"
        >
        </el-table-column>
        <el-table-column
          v-if="false"
          prop="SYS_ASSET_A1_170"
          label="编辑控件类型"
        >
        </el-table-column>
        <el-table-column width="110px" fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button
              size="mini"
              @click="showsysAssetA1edit(scope.row)"
              icon="el-icon-edit"
              v-btnper="''"
              >编辑</el-button
            >
            <!-- <el-button size="mini" icon="el-icon-delete" v-btnper="''">
              删除
            </el-button> -->
          </template>
        </el-table-column>
      </el-table>
    </el-main>
    <el-footer class="main-footer ">
      <mei-pagination :pageTotal="sysassetA1Data.length" v-model="paginations">
      </mei-pagination>
    </el-footer>
  </el-container>
</template>

<script>
import { SysAssetA1 } from "@/api";
import sysAssetA1Edit from "./sysAssetA1Edit";
export default {
  data() {
    return {
      loading: false,
      txtsearch: {
        SYS_ASSET_A1_160: "",
        SYS_ASSET_A1_50: "",
        SYS_ASSET_A1_60: "",
        SYS_ASSET_A1_140: ""
      },
      sysassetA1Data: [],
      paginations: {}
    };
  },
  //外部属性
  props: {},
  //内部方法
  methods: {
    async initPage() {
      const loading = this.$loading({
        target: this.$refs.table.$el,
        lock: true,
        text: "加载中..."
      });
      this.sysassetA1Data = await SysAssetA1.get(this.txtsearch);
      this.$nextTick(() => {
        loading.close();
      });
    },
    //打开页面
    showsysAssetA1edit(item) {
      this.getsysAssetA1Edit().show({ form: { ...item } });
    },
    //打开编辑
    getsysAssetA1Edit() {
      let edit = this.$window(sysAssetA1Edit, "编辑资产字段");
      edit.$on("onSysAssetA1Save", (res, data) => {
        res.MsRbool && this.initPage();
      });
      return edit;
    }
  },
  //组件
  components: {},
  //初始化 异步加async await
  mounted() {
    this.initPage();
  },
  //计算属性
  computed: {
    //内存分页
    tableData() {
      let _data = this.sysassetA1Data;
      const { index = 1, size = 10 } = this.paginations;
      _data = this.sysassetA1Data.slice((index - 1) * size, size * index);
      return _data;
    }
  },
  //监视
  watch: {
    txtsearch: {
      handler() {
        this.initPage();
      },
      deep: true
    }
  }
};
</script>

<style lang="scss" scoped>
.searchform {
  /deep/ .el-form-item {
    margin-bottom: 0px;
  }
}
</style>
